package com.persistence;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;


@Entity(name = "ADDRESS")
@Table(name="address")
@NamedQueries(
		@NamedQuery(name = "selectallAddress",query = "SELECT A FROM ADDRESS A")
	)
public class Address implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@TableGenerator(name = "ADDRESS_SEQ", table = "tbsequence", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "ADDRESS_IDX", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "ADDRESS_SEQ")
	@Column(name = "ID")
	private Integer id;
	
	@Column(name = "STREETNO")
	private String streetno;
	
	@Column(name = "APTNO")
	private String aptno;
	
	@Column(name = "ZIPCODE")
	private String zipcode;
	
	@Column(name = "CITY")
	private String city;
	
	@Column(name = "COUNTRY")
	private String country;
	
	@Column(name = "STATE")
	private String state;
	
	@Column(name = "STREETNAME")
	private String streetname;
	
	@OneToOne( optional=false , cascade=CascadeType.ALL,
			mappedBy="addressBean", targetEntity=Primarymember.class)
	private Primarymember primarymembers;
	
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getStreetno() {
		return streetno;
	}
	public void setStreetno(String streetno) {
		this.streetno = streetno;
	}
	public String getAptno() {
		return aptno;
	}
	public void setAptno(String aptno) {
		this.aptno = aptno;
	}
	public String getZipcode() {
		return zipcode;
	}
	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getStreetname() {
		return streetname;
	}
	public void setStreetname(String streetname) {
		this.streetname = streetname;
	}
	public Primarymember getPrimarymembers() {
		return primarymembers;
	}
	public void setPrimarymembers(Primarymember primarymembers) {
		this.primarymembers = primarymembers;
	}
	
	
}